<?php
/**
 * Created by PhpStorm.
 * User: hgq
 * Date: 16/6/15
 * Time: 上午9:35
 */

$isadmin = \app\models\Permission::isSystemAdmin();
?>

<div>
    <?php
    if ($goods != '') {
        ?>
    <form class="form-inline" role="form">
        <div class="form-group">
            <input type="hidden" id="edit_institution_code" class="form-control" value="<?= $goods["institution_code"] ?>" disabled>

            <label for="exampleInputEmail2">商品编码：</label>
            <input type="text" id="edit_code" class="form-control" value="<?= $goods["code"] ?>" disabled>

            <label for="exampleInputPassword2">商品名称：</label>
            <input type="text" id="edit_name" class="form-control" value="<?= $goods["name"] ?>" disabled>
        </div>
        <div class="form-group" style=" margin-top: 3px">
            <label for="exampleInputEmail2">展示名称：</label>
            <input type="text" id="edit_display_name" class="form-control" value="<?= $goods["display_name"] ?>" disabled>

            <label for="exampleInputPassword2">概要描述：</label>
            <input type="text" id="edit_summary" class="form-control" value="<?= $goods["summary"] ?>" disabled>
        </div>
        <div class="form-group" style=" margin-top: 3px">
            <label for="exampleInputEmail2">同款编码：</label>
            <input type="text" id="edit_group_code" class="form-control" value="<?= $goods["group_code"] ?>" disabled>

            <label for="exampleInputPassword2">差异名称：</label>
            <input type="text" id="edit_group_item_name" class="form-control" value="<?= $goods["group_item_name"] ?>" disabled>
        </div>
        <div class="form-group" style=" margin-top: 3px">
            <label for="exampleInputEmail2">商品规格：</label>
            <input type="text" id="edit_format" class="form-control" value="<?= $goods["format"] ?>" disabled>

            <label for="exampleInputPassword2">商品型号：</label>
            <input type="text" id="edit_model" class="form-control" value="<?= $goods["model"] ?>" disabled>
        </div>
        <div class="form-group" style=" margin-top: 3px">
            <label for="exampleInputEmail2">商品品牌：</label>
            <input type="text" id="edit_brand" class="form-control" value="<?= $goods["brand"] ?>" disabled>

            <label for="exampleInputPassword2">商品类型：</label>
            <select id="edit_type" class="form-control" style=" width: 203px" onchange="" disabled>
                <option value="1" <?php if ($goods["type"] == "1") echo "selected=\"selected\""; ?>>实物</option>
                <option value="2" <?php if ($goods["type"] == "2") echo "selected=\"selected\""; ?>>虚拟商品</option>
            </select>
        </div>
        <div class="form-group" style=" margin-top: 3px">
            <label for="exampleInputEmail2">组合类型：</label>
            <select id="edit_bind_type" class="form-control" style=" width: 203px" onchange="" disabled>
                <option value="1" <?php if ($goods["bind_type"] == "1") echo "selected=\"selected\""; ?>>单品</option>
                <option value="2" <?php if ($goods["bind_type"] == "2") echo "selected=\"selected\""; ?>>组合商品</option>
            </select>
            <label for="exampleInputEmail2">结算价格：</label>
            <input type="text" id="edit_settlement_price" class="form-control" value="<?= $goods["settlement_price"] ?>" readonly>
        </div>
        <div class="form-group" style=" margin-top: 3px">
            <label for="exampleInputEmail2">销售价格：</label>
            <input type="text" id="edit_selling_price" class="form-control" value="<?= $goods["selling_price"] ?>" <?php if(!$isadmin) {echo 'readonly';} else{ if($goods["is_custom_price"]!=1){echo 'readonly';} }?>>

            <label for="exampleInputEmail2">供应价格：</label>
            <input type="text" id="edit_supply_price" class="form-control" value="<?= $goods["supply_price"] ?>" <?php if(!$isadmin) {echo 'readonly';} else{ if($goods["is_custom_price"]!=1){echo 'readonly';} }?>>
        </div>
        <div class="form-group" style=" margin-top: 3px">
            <label for="exampleInputEmail2">所属分类：</label>
            <select id="edit_category" class="form-control" style=" width: 203px" onchange="">
                <?php
                if ($catelist != '') {
                    for ($i = 0; $i < count($catelist); $i++) {
                        ?>
                        <option value="<?= $catelist[$i]['code'] ?>" <?php if ($goods["category_code"] == $catelist[$i]['code']) echo "selected=\"selected\""; ?>><?= $catelist[$i]['name'] ?></option>
                        <?php
                    }
                }
                ?>
            </select>

            <label>
                <input type="checkbox" style=" margin-left: 60px" <?php if ($goods["is_crossborder"] == 1) {
                    echo("checked");
                } ?> disabled> 是否跨境商品
            </label>
        </div>
        <br>
        <div class="checkbox" style="margin-top: 5px">
            <label>
                <input type="checkbox" id="edit_is_enabled" <?php if ($goods["is_enabled"] == 1) {
                    echo("checked");
                } ?>>是否启用
            </label>
            <label>
                <input type="checkbox" id="edit_is_shelved" style="margin-left: 60px" onclick="editIsShelvedOnClick()" <?php if ($goods["is_shelved"] == 1) {
                    echo("checked");
                } ?>> 是否上架
            </label>
            <label for="exampleInputEmail2" style="margin-left: 71px">上架时间：</label>
            <input type="hidden" id="edit_shelve_datetime_old" class="form-control" value="<?= $goods["shelve_datetime"] ?>" disabled>
            <input type="text" id="edit_shelve_datetime" class="form-control" value="<?= $goods["shelve_datetime"] ?>" disabled>
        </div>
        <br>
        <div class="checkbox" style=" margin-top: 15px">
            <label>
                <input type="checkbox" id="edit_is_newest" <?php if ($goods["is_newest"] == 1) {
                    echo("checked");
                } ?>> 是否新品
            </label>
            <label>
                <input type="checkbox" id="edit_is_activity" style=" margin-left: 56px" <?php if ($goods["is_activity"] == 1) {
                    echo("checked");
                } ?> disabled> 是否活动商品
            </label>
            <label>
                <input type="checkbox" id="edit_is_trusteeship" style="margin-left: 48px"<?php if ($goods["is_trusteeship"] == 1) {
                    echo("checked");
                } ?> disabled> 是否托管商品
            </label>
        </div>
        <br>
        <div class="checkbox" style=" margin-top: 15px">
            <label>
                <input type="checkbox" id="edit_is_hot" <?php if ($goods["is_hot"] == 1) {
                    echo("checked");
                } ?>> 是否热销
            </label>
            <label>
                <input type="checkbox" id="edit_is_top" style=" margin-left: 56px" <?php if ($goods["is_top"] == 1) {
                    echo("checked");
                } ?>> 是否置顶
            </label>
            <label>
                <input type="checkbox"  id="edit_is_show" style="margin-left: 76px"<?php if ($goods["is_show"] == 1) {
                    echo("checked");
                } ?>> 是否显示
            </label>
        </div>
        <div class="checkbox" style=" margin-top: 15px">
            <label>
                <input type="checkbox" id="edit_is_modified" <?php if ($goods["is_modified"] == 1) {
                    echo("checked");
                } ?> disabled> 此商品信息是否编辑修改过
            </label>
            <label for="exampleInputEmail2" style="margin-left: 60px">最后修改时间：</label>
            <input type="text" id="edit_modify_datetime" class="form-control" value="<?= $goods["modify_datetime"] ?>" disabled>
        </div>
    </form>
        <?php
    }
    ?>
</div>

